<%@ page language="java" import="java.util.*" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Overview</title>
<link href="/css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
	Integer resQuantity = null;
if(session.getAttribute("Resources")!=null){
	resQuantity = (Integer)session.getAttribute("Resources");
}
%>
	<div style="width: 100%;text-align:center;">
		Welcome Commander!
		<br />
		Resources: <%=resQuantity%>
	</div>
	<div style="width: 300px;height: 100%; float: left">
		<a href="Overview" style="width: 300px;float: left">Overview</a>
		<a href="Structures" style="width: 300px;float: left">Structures</a>
		<a href="Research" style="width: 300px;float: left">Research</a>
		<a href="Barracks" style="width: 300px;float: left">Barracks</a>
		<a href="Island" style="width: 300px;float: left">Island</a>
		<a href="Movement" style="width: 300px;float: left">Movement Report</a>
		<a href="Messages" style="width: 300px;float: left">Messages</a>
	</div>
	<div style="width: 300px; float: right">
		<%
		ArrayList<Integer> Address = (ArrayList<Integer>)request.getAttribute("Address");
		ArrayList<Integer> Size = (ArrayList<Integer>)request.getAttribute("Size");
		ArrayList<Integer> Resources = (ArrayList<Integer>)request.getAttribute("Resources");
		if(Address!=null){
			Iterator<Integer> add = Address.iterator();
			Iterator<Integer> siz = Size.iterator();
			Iterator<Integer> res = Resources.iterator();
			while(add.hasNext()){
				int next_add = add.next();
				if(session.getAttribute("P_ADDRESS")==null){
					session.setAttribute("P_ADDRESS", next_add);
				}
				out.print("<a href=\"Overview?add=" + next_add +"\">");
				out.print("<div> Address: ");
				out.print(next_add);
				out.print("<br/>Size: ");
				out.print(siz.next());
				out.print("</div>");
				out.print("<div>Resources: ");
				out.print(res.next());
				out.print("</div>");
				out.print("</a>");
				out.print("<br/><br/>");
			} 
		} else {
			out.println("No DATA");
			out.println(Address);
		}
		%>
	</div>
</body>
</html>
